home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 4490 / 4490.xpi / components / scripts / naver.js < prev    next >
Text File  |  2010-01-22  |  2KB  |  54 lines

  1. /***********************************************************
  2. naver
  3. ***********************************************************/
  4. var hostString="";
  5. var supportInboxOnly=true;
  6. var supportShowFolders=true;
  7.  
  8. function init(){
  9.   this.dataURL="http://mail.naver.com";
  10.   this.loginData=["https://nid.naver.com/nidlogin.login",
  11.                       "id","pw",
  12.                       "url="+encodeURIComponent(this.dataURL)+"&cert=no&nomap=0&saveID=0&ssllogin=1"];
  13.   this.mailURL="http://mail.naver.com";
  14.   this.mailDomain="mail.naver.com";  
  15. }
  16. function getData(aData){
  17.   var obj={};
  18.   this.folders={};//used for direct link
  19.   var re=/{\"FolderSN\":\"(\S+?)\",\"FolderType\":\"(.+?)\".+?\"FolderName\":\"(.+?)\",\"UnreadMailCount\":\"(\d+)\"/g;
  20.   var o;
  21.   var ar=[];
  22.   this.mailCount=0;
  23.   var found=false;
  24.   while ((o = re.exec(aData)) != null){
  25.     if(o[2]=="S"&&o[1]!="0")continue;
  26.     var found=true;
  27.     var n=parseInt(o[4]);    
  28.     if(this.inboxOnly){
  29.       if(o[1]=="0")this.mailCount=n;
  30.     }else this.mailCount+=n;
  31.     if(n>0&&o[1]!="0"){
  32.       var name=unescape(o[3].replace(/\\/g,"%"));
  33.       this.folders[name]=o[1];    
  34.       ar.push(name);
  35.       ar.push(n);
  36.     }
  37.   }
  38.   if(this.showFolders){
  39.     if(ar)obj.folders=encodeArray(ar);  
  40.   }
  41.   if(!found)this.mailCount=-1;
  42.   return obj;
  43. }
  44. function getCount(aData){
  45.   return this.mailCount;
  46. }
  47. function getMailURL(aFolder){
  48.   if(this.dataURLCopy){
  49.     var url=this.dataURLCopy+"#"+encodeURIComponent("folderSN="+(aFolder?this.folders[aFolder]:0)+"÷=1&page=1&type=list");
  50.     return url;
  51.   }
  52.   return this.mailURL;  
  53. }
  54.